﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FlexCell;
using YArchitech.HVAC.Nozzle;
using YArchitech.LIB;

namespace YArchitech.HVAC
{
	public partial class FrmBallTable : System.Windows.Forms.Form
	{
		public FrmBallTable(DataTable DtGlobeNozzleFormat)
		{
			this.InitializeComponent();
			new YJKProcessTools().ShowInTaskbarChange(this);
			this.dtGlobeNozzleFormat = DtGlobeNozzleFormat;
			this.initGrid();
			this.initDic();
			this.initSprinklerList();
		}

		private void initSprinklerList()
		{
			if (this.dtGlobeNozzleFormat != null && this.dtGlobeNozzleFormat.Rows.Count > 0)
			{
				foreach (object obj in this.dtGlobeNozzleFormat.Rows)
				{
					DataRow dataRow = (DataRow)obj;
					this.FormatList.Add(new FormatData
					{
						Format = ((dataRow["GuiGe"] == DBNull.Value) ? "" : dataRow["GuiGe"].ToString()),
						ThroatDiameter = ((dataRow["HouKouDn"] == DBNull.Value) ? "" : dataRow["HouKouDn"].ToString()),
						AirDiameter = ((dataRow["FengKouDn"] == DBNull.Value) ? "" : dataRow["FengKouDn"].ToString()),
						D1 = ((dataRow["D1"] == DBNull.Value) ? "" : dataRow["D1"].ToString()),
						D2 = ((dataRow["D2"] == DBNull.Value) ? "" : dataRow["D2"].ToString()),
						D3 = ((dataRow["D3"] == DBNull.Value) ? "" : dataRow["D3"].ToString()),
						D4 = ((dataRow["D4"] == DBNull.Value) ? "" : dataRow["D4"].ToString()),
						E = ((dataRow["E"] == DBNull.Value) ? "" : dataRow["E"].ToString()),
						F = ((dataRow["F"] == DBNull.Value) ? "" : dataRow["F"].ToString()),
						L1 = ((dataRow["L1"] == DBNull.Value) ? "" : dataRow["L1"].ToString()),
						L2 = ((dataRow["L2"] == DBNull.Value) ? "" : dataRow["L2"].ToString())
					});
				}
			}
		}

		private void initGrid()
		{
			base.Icon = (base.Icon = Resource.YArchitechIcon);
			string fileName = Path.Combine(Product.DataLocation, "k2.xml");
			this.grid1.LoadFromXML(fileName);
			this.grid1.Row(0).Visible = false;
			this.grid1.Column(0).Visible = false;
			this.grid1.AutoSize = true;
			this.grid1.Locked = true;
		}

		private void initDic()
		{
			this.InitDicByRange();
			this.InitDicBySingle();
		}

		private void InitDicBySingle()
		{
			this.dic.Add("3:4:5:4", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "160",
					AirQuantity = "83",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:5", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "200",
					AirQuantity = "104",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:6", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "250",
					AirQuantity = "133",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:7", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "315",
					AirQuantity = "180",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:8", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "400",
					AirQuantity = "234",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:9", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "100",
					AirQuantity = "94",
					Noise = "29"
				}
			});
			this.dic.Add("3:4:5:10", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "125",
					AirQuantity = "122",
					Noise = "25"
				}
			});
			this.dic.Add("3:4:5:11", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "160",
					AirQuantity = "166",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:12", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "200",
					AirQuantity = "220",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:13", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "250",
					AirQuantity = "274",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:14", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "315",
					AirQuantity = "353",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:15", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "400",
					AirQuantity = "464",
					Noise = "<20"
				}
			});
			this.dic.Add("3:4:5:16", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "100",
					AirQuantity = "140",
					Noise = "41"
				}
			});
			this.dic.Add("3:4:5:17", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "125",
					AirQuantity = "180",
					Noise = "36"
				}
			});
			this.dic.Add("3:4:5:18", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "160",
					AirQuantity = "248",
					Noise = "35"
				}
			});
			this.dic.Add("3:4:5:19", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "200",
					AirQuantity = "306",
					Noise = "27"
				}
			});
			this.dic.Add("3:4:5:20", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "250",
					AirQuantity = "382",
					Noise = "22"
				}
			});
			this.dic.Add("3:4:5:21", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "315",
					AirQuantity = "540",
					Noise = "20"
				}
			});
			this.dic.Add("3:4:5:22", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "400",
					AirQuantity = "702",
					Noise = "<20"
				}
			});
			string speed = "0.5";
			string range = "10";
			this.dic.Add("8:9:10:2", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "94",
					Noise = "29"
				}
			});
			this.dic.Add("8:9:10:3", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "122",
					Noise = "25"
				}
			});
			this.dic.Add("8:9:10:4", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "166",
					Noise = "<20"
				}
			});
			this.dic.Add("8:9:10:5", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "220",
					Noise = "<20"
				}
			});
			this.dic.Add("8:9:10:6", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "274",
					Noise = "<20"
				}
			});
			this.dic.Add("8:9:10:7", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "353",
					Noise = "<20"
				}
			});
			this.dic.Add("8:9:10:8", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "464",
					Noise = "<20"
				}
			});
			range = "20";
			this.dic.Add("8:9:10:9", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "187",
					Noise = "50"
				}
			});
			this.dic.Add("8:9:10:10", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "245",
					Noise = "46"
				}
			});
			this.dic.Add("8:9:10:11", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "331",
					Noise = "44"
				}
			});
			this.dic.Add("8:9:10:12", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "436",
					Noise = "38"
				}
			});
			this.dic.Add("8:9:10:13", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "547",
					Noise = "34"
				}
			});
			this.dic.Add("8:9:10:14", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "702",
					Noise = "28"
				}
			});
			this.dic.Add("8:9:10:15", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "929",
					Noise = "20"
				}
			});
			range = "30";
			this.dic.Add("8:9:10:18", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "497",
					Noise = "55"
				}
			});
			this.dic.Add("8:9:10:19", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "655",
					Noise = "50"
				}
			});
			this.dic.Add("8:9:10:20", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "824",
					Noise = "45"
				}
			});
			this.dic.Add("8:9:10:21", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "1055",
					Noise = "40"
				}
			});
			this.dic.Add("8:9:10:22", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "1393",
					Noise = "33"
				}
			});
			speed = "1.0";
			range = "10";
			this.dic.Add("13:14:15:2", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "187",
					Noise = "50"
				}
			});
			this.dic.Add("13:14:15:3", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "245",
					Noise = "46"
				}
			});
			this.dic.Add("13:14:15:4", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "331",
					Noise = "44"
				}
			});
			this.dic.Add("13:14:15:5", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "436",
					Noise = "38"
				}
			});
			this.dic.Add("13:14:15:6", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "547",
					Noise = "34"
				}
			});
			this.dic.Add("13:14:15:7", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "702",
					Noise = "28"
				}
			});
			this.dic.Add("13:14:15:8", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "929",
					Noise = "20"
				}
			});
			range = "20";
			this.dic.Add("13:14:15:13", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "1098",
					Noise = "53"
				}
			});
			this.dic.Add("13:14:15:14", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "1404",
					Noise = "48"
				}
			});
			this.dic.Add("13:14:15:15", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = "30",
					Format = "400",
					AirQuantity = "1858",
					Noise = "42"
				}
			});
			range = "30";
			this.dic.Add("13:14:15:22", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "2783",
					Noise = "53"
				}
			});
		}

		private void InitDicByRange()
		{
			this.dic.Add("2:2", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "160",
					AirQuantity = "83",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "200",
					AirQuantity = "104",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "250",
					AirQuantity = "133",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "315",
					AirQuantity = "180",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "10",
					Format = "400",
					AirQuantity = "234",
					Noise = "<20"
				}
			});
			this.dic.Add("2:9", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "100",
					AirQuantity = "94",
					Noise = "29"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "125",
					AirQuantity = "122",
					Noise = "25"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "160",
					AirQuantity = "166",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "200",
					AirQuantity = "220",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "250",
					AirQuantity = "274",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "20",
					Format = "315",
					AirQuantity = "353",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "400",
					AirQuantity = "464",
					Noise = "<20"
				}
			});
			this.dic.Add("2:16", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "100",
					AirQuantity = "140",
					Noise = "41"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "125",
					AirQuantity = "180",
					Noise = "36"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "160",
					AirQuantity = "248",
					Noise = "35"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "200",
					AirQuantity = "306",
					Noise = "27"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "250",
					AirQuantity = "382",
					Noise = "22"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "315",
					AirQuantity = "540",
					Noise = "20"
				},
				new SprinklerBallData
				{
					Speed = "0.25",
					Range = "30",
					Format = "400",
					AirQuantity = "702",
					Noise = "<20"
				}
			});
			string speed = "0.5";
			string range = "10";
			this.dic.Add("7:2", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "94",
					Noise = "29"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "122",
					Noise = "25"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "166",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "220",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "274",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "353",
					Noise = "<20"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "464",
					Noise = "<20"
				}
			});
			range = "20";
			this.dic.Add("7:9", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "187",
					Noise = "50"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "245",
					Noise = "46"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "331",
					Noise = "44"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "436",
					Noise = "38"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "547",
					Noise = "34"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "702",
					Noise = "28"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = "30",
					Format = "400",
					AirQuantity = "929",
					Noise = "20"
				}
			});
			range = "30";
			this.dic.Add("7:16", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "497",
					Noise = "55"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "655",
					Noise = "50"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "824",
					Noise = "45"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "1055",
					Noise = "40"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "1393",
					Noise = "33"
				}
			});
			speed = "1.0";
			range = "10";
			this.dic.Add("12:2", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "100",
					AirQuantity = "187",
					Noise = "50"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "125",
					AirQuantity = "245",
					Noise = "46"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "160",
					AirQuantity = "331",
					Noise = "44"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "200",
					AirQuantity = "436",
					Noise = "38"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "547",
					Noise = "34"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "702",
					Noise = "28"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "929",
					Noise = "20"
				}
			});
			range = "20";
			this.dic.Add("12:9", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "250",
					AirQuantity = "1098",
					Noise = "53"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "315",
					AirQuantity = "1404",
					Noise = "48"
				},
				new SprinklerBallData
				{
					Speed = speed,
					Range = "30",
					Format = "400",
					AirQuantity = "1858",
					Noise = "42"
				}
			});
			range = "30";
			this.dic.Add("12:16", new List<SprinklerBallData>
			{
				new SprinklerBallData
				{
					Speed = speed,
					Range = range,
					Format = "400",
					AirQuantity = "2783",
					Noise = "53"
				}
			});
		}

		private void button2_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		private void grid1_DoubleClick(object Sender, EventArgs e)
		{
			string text = this.grid1.ActiveCell.Row.ToString();
			string text2 = this.grid1.ActiveCell.Col.ToString();
			if (this.dic.ContainsKey(text + ":" + text2))
			{
				this.SprinklerRes = this.dic[text + ":" + text2];
				base.Close();
				this.grow = text;
				this.gcol = text2;
			}
			else if (this.dic.ContainsKey(this.getSingleKey(text, text2)))
			{
				this.SprinklerRes = this.dic[this.getSingleKey(text, text2)];
				base.Close();
				this.grow = text;
				this.gcol = text2;
			}
			if (this.SprinklerRes != null && this.SprinklerRes.Count > 0)
			{
				this.setGlobeNozzles();
			}
		}

		public void GetGlobeNozzlesByDefault(string row, string col)
		{
			if (this.dic.ContainsKey(row + ":" + col))
			{
				this.SprinklerRes = this.dic[row + ":" + col];
			}
			else if (this.dic.ContainsKey(this.getSingleKey(row, col)))
			{
				this.SprinklerRes = this.dic[this.getSingleKey(row, col)];
			}
			if (this.SprinklerRes != null && this.SprinklerRes.Count > 0)
			{
				this.setGlobeNozzles();
			}
		}

		private void setGlobeNozzles()
		{
			using (List<SprinklerBallData>.Enumerator enumerator = this.SprinklerRes.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					SprinklerBallData item = enumerator.Current;
					FormatData formatData = (from s in this.FormatList
					where s.Format == item.Format
					select s).FirstOrDefault<FormatData>();
					if (formatData != null)
					{
						double fengKouDn = ((from s in this.FormatList
						where s.Format == item.Format
						select s).FirstOrDefault<FormatData>() != null) ? (from s in this.FormatList
						where s.Format == item.Format
						select s).FirstOrDefault<FormatData>().AirDiameter.ToDouble(0.0) : 0.0;
						double houKouDn = ((from s in this.FormatList
						where s.Format == item.Format
						select s).FirstOrDefault<FormatData>() != null) ? (from s in this.FormatList
						where s.Format == item.Format
						select s).FirstOrDefault<FormatData>().ThroatDiameter.ToDouble(0.0) : 0.0;
						this.GlobeNozzles.Add(new GlobeNozzle
						{
							FengSu = Convert.ToDouble(item.Speed),
							SheCheng = Convert.ToInt32(item.Range),
							FengLiang = Convert.ToInt32(item.AirQuantity),
							GuiGe = Convert.ToInt32(item.Format),
							FengKouDn = fengKouDn,
							HouKouDn = houKouDn,
							D1 = formatData.D1.ToDouble(0.0),
							D2 = formatData.D2.ToDouble(0.0),
							D3 = formatData.D3.ToDouble(0.0),
							D4 = formatData.D4.ToDouble(0.0),
							E = formatData.E.ToDouble(0.0),
							F = formatData.F.ToDouble(0.0),
							L1 = formatData.L1.ToDouble(0.0),
							L2 = formatData.L2.ToDouble(0.0)
						});
					}
				}
			}
		}

		private string getSingleKey(string Row, string Col)
		{
			if (Row == "3" || Row == "4" || Row == "5")
			{
				return "3:4:5:" + Col;
			}
			if (Row == "8" || Row == "9" || Row == "10")
			{
				return "8:9:10:" + Col;
			}
			if (Row == "13" || Row == "14" || Row == "15")
			{
				return "13:14:15:" + Col;
			}
			return Row + Col;
		}

		private Dictionary<string, List<SprinklerBallData>> dic = new Dictionary<string, List<SprinklerBallData>>();

		private List<SprinklerBallData> SprinklerRes = new List<SprinklerBallData>();

		public List<GlobeNozzle> GlobeNozzles = new List<GlobeNozzle>();

		public string grow = "0";

		public string gcol = "0";

		private List<FormatData> FormatList = new List<FormatData>();

		private DataTable dtGlobeNozzleFormat;
	}
}
